﻿Imports DevComponents.DotNetBar

Public Class FrmCatalogoCompras

    Private Sub FrmCatalogoCompras_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            'TODO: esta línea de código carga datos en la tabla 'DataSet_Prod_Serv.Documentos' Puede moverla o quitarla según sea necesario.
            Me.DocumentosTableAdapter.Fill_ComprasProveedor(Me.DataSet_Prod_Serv.Documentos)

            lblNombre.ForeColor = SystemColors.MenuHighlight
            panelOpciones.BackColor = Color.Black
            slideOpciones.BackColor = Color.Black


            slideAcciones.IsOpen = False
            slideNuevo.IsOpen = False
            slideOpciones.IsOpen = False
            slideReportes.IsOpen = False

            For Each fila As DataGridViewRow In Me.dgvCompras.Rows
                If Me.dgvCompras.Rows(fila.Index).Cells(13).Value Then
                    Me.dgvCompras.Rows(fila.Index).DefaultCellStyle.BackColor = Color.Red
                End If
                Me.dgvCompras.Rows(fila.Index).Cells(4).Value = Me.DataSet_Prod_Serv.Autobuses.Item(fila.Index)(17)
            Next
        Catch ex As Exception
            ToastNotification.Show(Me, ex.Message, My.Resources.appbar_cone, 5000, eToastGlowColor.Red, eToastPosition.MiddleCenter)
        End Try
    End Sub

    Private Sub btnMostrarOpciones_Click(sender As Object, e As EventArgs) Handles btnMostrarOpciones.Click
        slideOpciones.IsOpen = True
    End Sub

    Private Sub AtrasBtn_Click(sender As Object, e As EventArgs) Handles AtrasBtn.Click
        Me.Close()
    End Sub

    Private Sub ButtonItem1_Click(sender As Object, e As EventArgs) Handles ButtonItem1.Click
        slideOpciones.IsOpen = False
    End Sub

    Private Sub btnNuevo_Click(sender As Object, e As EventArgs) Handles btnNuevo.Click
        slideNuevo.IsOpen = True
    End Sub

    Private Sub btnCerrar_Click(sender As Object, e As EventArgs) Handles btnCerrar.Click
        slideNuevo.IsOpen = False
    End Sub

    Private Sub ButtonItem17_Click(sender As Object, e As EventArgs) Handles ButtonItem17.Click
        slideReportes.IsOpen = True
    End Sub

    Private Sub ButtonItem2_Click(sender As Object, e As EventArgs) Handles ButtonItem2.Click
        slideReportes.IsOpen = False
    End Sub

    Private Sub btnNuevoCapturaProducto_Click(sender As Object, e As EventArgs) Handles btnNuevoCapturaProducto.Click
        _Editar = False
        FrmCapturaCompra.Show()
        Me.Close()
    End Sub

    Private Sub Ocultar_Panel() Handles Me.Click, dgvCompras.Click
        slideOpciones.IsOpen = False
        slideNuevo.IsOpen = False
        slideReportes.IsOpen = False
        slideAcciones.IsOpen = False
    End Sub

    Private Sub ButtonItem12_Click(sender As Object, e As EventArgs) Handles ButtonItem12.Click
        slideAcciones.IsOpen = True
    End Sub

    Private Sub ButtonItem19_Click(sender As Object, e As EventArgs) Handles ButtonItem19.Click
        slideAcciones.IsOpen = False
    End Sub

    Private Sub btnEditar_Click(sender As Object, e As EventArgs) Handles btnEditar.Click
        _Editar = True
        FrmCapturaCompra.Show()
        Me.Close()
    End Sub

    Private Sub dgvCompras_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvCompras.CellClick
        Try
            _IDCOMPRA = Me.dgvCompras.Rows(Me.dgvCompras.CurrentRow.Index).Cells(0).Value
        Catch ex As Exception
            ToastNotification.Show(Me, ex.Message, My.Resources.appbar_cone, 5000, eToastGlowColor.Red, eToastPosition.MiddleCenter)
        End Try
    End Sub

    Private Sub dgvCompras_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvCompras.CellDoubleClick
        btnEditar_Click(Nothing, Nothing)
    End Sub
End Class